package com.mia.craftstudio.minecraft;

import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;

public class CSMsgAnimationUpdate implements IMessage {
   private IAnimatedTile propsTile;
   private AnimationState animationInfo;

   public CSMsgAnimationUpdate() {
   }

   public CSMsgAnimationUpdate(IAnimatedTile tile, AnimationState animationInfo) {
      this.propsTile = tile;
      this.animationInfo = animationInfo;
   }

   public void fromBytes(ByteBuf buf) {
      AnimationManager.addAnimationState(new BlockDimensionalPosition(buf), new AnimationState(buf));
   }

   public void toBytes(ByteBuf buf) {
      this.propsTile.getBlockPosDim().write(buf);
      this.animationInfo.write(buf);
   }

   public static class Handler<T extends CSMsgAnimationUpdate> implements IMessageHandler<T, CSMsgAnimationUpdate> {
      public CSMsgAnimationUpdate onMessage(CSMsgAnimationUpdate message, MessageContext ctx) {
         return null;
      }
   }
}
